package MediaOnline.GUI;

import java.util.ArrayList;

import MediaOnline.Data.filmDetail;
import android.net.NetworkInfo.DetailedState;

public class LstVideoViewInfo {

	private static LstVideoViewInfo instance = null;

	protected LstVideoViewInfo() {
		// Lay db
	}

	public static synchronized LstVideoViewInfo getInstance() {
		if (instance == null) {

			instance = new LstVideoViewInfo();
		}
		return instance;

	}

	public static ArrayList<filmDetail> videoRows = new ArrayList<filmDetail>();

	public int iCurrentVideo;
	public int iLike;

	public int lbookmark;

	public int getLbookmark() {
		return lbookmark;
	}

	public void setLbookmark(int lbookmark) {
		this.lbookmark = lbookmark;
	}

	public int getiLike() {
		return iLike;
	}

	public void setiLike(int iLike) {
		this.iLike = iLike;
	}

	public int getNext() {
		int iNext = iCurrentVideo;
		if (iCurrentVideo < videoRows.size())
			return ++iNext;
		return iNext;
	}

	// chon bai hat ke tiep
	public int getPrevious() {
		int iPre = iCurrentVideo;
		if (iCurrentVideo >= 0 || iCurrentVideo < videoRows.size()) {
			return --iPre;
		}
		return iPre;
	}

	//
	public void setNext(int iNext) {
		if (iNext > 0 && iNext < videoRows.size()) {
			instance.iCurrentVideo = iNext;
		}

	}

	//
	public void setPrevious(int iPre) {
		if (iPre > 0 && iPre < videoRows.size()) {
			instance.iCurrentVideo = iPre;
		}

	}

	// Lay id tu danh sach list
	public int getId(int idx) {
		int count = -1;
		for (filmDetail v : videoRows) {
			++count;
			if (Integer.parseInt(v.FilmID) == idx) {
				instance.iCurrentVideo = count;
				return count;
			}

		}

		return count;
	}

	// set bai hat truoc do
	public void setPrevious() {

		if (iCurrentVideo == 0) {
			instance.iCurrentVideo = iCurrentVideo;
		} else {
			instance.iCurrentVideo--;
		}
	}

	public void setNext() {
		if (iCurrentVideo < videoRows.size()) {
			instance.iCurrentVideo = iCurrentVideo;
		} else {
			instance.iCurrentVideo++;
			;
		}

	}

	public filmDetail vvInfo(int i) {
		return videoRows.get(i);
	}

	public filmDetail vvInfo() {
		return videoRows.get(iCurrentVideo);
	}
	//

}
